package com.tang.model.v1;

import com.tang.model.domain.Member;

/**
 * @Author tangyuan2meicloud.com
 * @DATE 2021/9/2 20:15
 * @Desc
 * @Remarks
 */
public class MemberService {
    private Handler handler;

    public MemberService() {
        handler = new CheckHandler();
        LoginHandler loginHandler = new LoginHandler();
        AuthHandler authHandler = new AuthHandler();
        authHandler.setNextHandle(null);
        loginHandler.setNextHandle(authHandler);
        handler.setNextHandle(loginHandler);
    }

    public void login(String username, String password) {
        Member member = new Member(username, password);
        handler.exec(member);
    }
}
